package org.company.earth.arithmetic;

import java.util.List;

public abstract class BaseSort<T> {
    
    public abstract void sort(List<T> list);
    
    public Integer compare(T first,T second) {
        return first.hashCode() - second.hashCode();
    }
    
    public boolean gt(T first,T second) {
        return this.compare(first, second) >= 0 ? true : false;
    }
    
    public void swap(List<T> list,int i,int j) {
        T temp = list.set(i, list.get(j));
        list.set(j, temp);
    }
    
    public void print(List<T> arr) {
        for(T t : arr) {
            System.out.print(t + ",");
        }
        System.out.println();
    }
}
